import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { OtherService } from './other/other.service';
import { OtherModule } from './other/other.module';
import { APP_FILTER } from '@nestjs/core';
import { HelloFilter } from './filters/hello.filter';
import { WinstonModule, utilities } from 'nest-winston';
import { PrismaService } from './prisma.service';

import { AuthModule } from './auth/auth.module';
import * as winston from 'winston';

@Module({
  imports: [
    OtherModule,
    WinstonModule.forRoot({
      transports: [
        new winston.transports.Console({
          format: winston.format.combine(
            winston.format.timestamp(),
            winston.format.ms(),
            utilities.format.nestLike('App', {
              colors: true,
              prettyPrint: true,
              processId: true,
              appName: true,
            }),
          ),
        }),
      ],
    }),
    AuthModule,
  ],
  controllers: [AppController],
  providers: [
    AppService,
    OtherService,
    {
      provide: 'person',
      useValue: {
        name: '张三',
        age: 20,
      },
    },
    {
      provide: APP_FILTER,
      useClass: HelloFilter,
    },
    PrismaService,
  ],
})
export class AppModule {}
